//package com.mocha.bss.excel;
//
//import com.alibaba.fastjson.JSON;
//import com.coffee.attachment.ExcelDownloadMQConstant;
//import com.coffee.attachment.ExcelDownloadMQMessage;
//import com.coffee.attachment.NotifyExcelDownloadDTO;
//import com.coffee.rocketmq.AbstractMochaRocketMQConsumer;
//import com.coffee.ws.CoffeeSessionManager;
//import com.coffee.ws.CoffeeWebsocketResponse;
//import com.mocha.bss.websocket.message.DocDownloadPushMessage;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.rocketmq.spring.annotation.MessageModel;
//import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
//import org.apache.rocketmq.spring.core.RocketMQListener;
//import org.springframework.stereotype.Component;
//
//import javax.websocket.Session;
//
///**
// * 实体类消费监听器，在实现RocketMQListener中间还加了一层BaseMqMessageListener来处理基础业务消息
// *
// * @author tianxincoord@163.com
// * @since 2022/5/12
// */
//@Slf4j
//@Component
//@RocketMQMessageListener(
//        topic = ExcelDownloadMQConstant.COFFEE_BROADCAST_WEB_TOPIC,
//        consumerGroup = ExcelDownloadMQConstant.COFFEE_BROADCAST_WEB_EXCEL_GROUP,
//        selectorExpression = ExcelDownloadMQConstant.COFFEE_BROADCAST_WEB_EXCEL_TAG,
//        messageModel = MessageModel.BROADCASTING
//)
//public class ExcelDownloadRocketMQListener extends AbstractMochaRocketMQConsumer<ExcelDownloadMQMessage> implements RocketMQListener<ExcelDownloadMQMessage> {
//
//    //固定写
//    @Override
//    public void onMessage(ExcelDownloadMQMessage message) {
//        onMochaMessage(message);
//    }
//
//    @Override
//    protected boolean isConsumedMessage(ExcelDownloadMQMessage message) {
//        return   false;
//    }
//
//    @Override
//    protected void consumeMessage(ExcelDownloadMQMessage message) {
//        log.info("ExcelDownloadMQMessage >>> key: {}", null == message ? "null" : message.getKey());
//        if (null == message || null == message.getPayload() || null == message.getPayload().getUserId()){
//            log.info("ExcelDownloadMQMessage is null");
//            return ;
//        }
//
//        NotifyExcelDownloadDTO dto = message.getPayload();
//        Session session = CoffeeSessionManager.getSession(dto.getUserId());
//        if (null != session){
//            DocDownloadPushMessage docDownloadPushMessage = DocDownloadPushMessage.builder().docId(dto.getDocId()).docTitle(dto.getDocTitle()).exceptionInfo(dto.getExceptionInfo()).build();
//            CoffeeSessionManager.sendText(session, JSON.toJSONString(CoffeeWebsocketResponse.responseSuccess(docDownloadPushMessage)));
//        }
//
//    }
//
//}
